'use strict';
/**
 * 
 */
import React, { PropTypes, Component } from 'react';

import ProductDetail from './ProductDetail';
import Loading from './loading';

class GroupList extends Component {
	
	render() {
		let { groupList = {data:{TuanList:[]}} ,isMyself } = this.props;
		
		let renderComponets = function(){
			if(groupList.state == 1){
				return <Loading show={ groupList.state }/>;
			}else{
				return (
					<ul className="group-list-wrapper">
						{ groupList.data && groupList.data.TuanList && groupList.data.TuanList.map((item,inx) => {
							return (
								<li className="group-item" key={item.TuanId+'_'+inx}>
									<ProductDetail info={ item } isDetail={ false } isMyself = {isMyself}/>
								</li>		
							)
						})}
					</ul>
				)
			}
		}
		return <div>{ renderComponets() }</div>
	}
}

export default GroupList